#ifndef TH_ISE113_I_H
#define TH_ISE113_I_H

#include <QMainWindow>
#include <QUdpSocket>
#include <QTimer>
#include <QKeyEvent>

namespace Ui {
class TH_ISE113_I;
}

class TH_ISE113_I : public QMainWindow
{
    Q_OBJECT

public:
    //轨道电压相角采集模块的数值结构体定义
    struct _dataFrame{
        float JBDY;        //局部电压值
        float GD1_DY;      //第1路轨道电压值
        float GD2_DY; float GD3_DY; float GD4_DY;
        float GD5_DY; float GD6_DY; float GD7_DY;
        float GD1_XJ;      //第1路轨道相角值
        float GD2_XJ; float GD3_XJ; float GD4_XJ;
        float GD5_XJ; float GD6_XJ; float GD7_XJ;
        float JBPL;       //局部频率
        quint16 KGL;       //7路轨道的开关量状态

        //默认构造函数
        _dataFrame()
        {
            JBDY = 0;
            GD1_DY = 0; GD2_DY = 0; GD3_DY = 0;
            GD4_DY = 0; GD5_DY = 0; GD6_DY = 0; GD7_DY = 0;
            GD1_XJ = 0; GD2_XJ = 0; GD3_XJ = 0;
            GD4_XJ = 0; GD5_XJ = 0; GD6_XJ = 0; GD7_XJ = 0;
            JBPL = 0;
            KGL = 0;
        }
    };
    typedef _dataFrame DataFrame;   //定义结构体数据类型DataFrame;

public:
    explicit TH_ISE113_I(QWidget *parent = 0);
    ~TH_ISE113_I();
    static DataFrame toDataFrame(QByteArray dat);

protected:
    void keyPressEvent(QKeyEvent *event);

private:
    void initialize();
    void setStatus(quint16 byteStatue);
    void setDisplay(DataFrame data);
    void clearDisplay();
    void readConfig();
    void writeConfig();
    void startOneTest();

private slots:
    void on_pushButton();
    void on_remoteIPChanged();
    void on_testTimeout();
    void on_spinBoxChanged(int arg);
    void on_socketReceive();
    void on_AutoTest();

private:
    Ui::TH_ISE113_I *ui;
    QByteArray arrayData;
    QUdpSocket socket;
    QTimer time;

};

#endif // TH_ISE113_I_H
